//************************************************************************
/// <copyrigth>2024-2025 Corporation.All Rights Reserved</copyrigth>
/// <author>tangyingzhong</author>
/// <contact>tangyz114987@outlook.com</contact>
/// <version>v1.0.0</version>
/// <describe>
/// Cross-Platform file
///</describe>
/// <date>2024/1/8</date>
///***********************************************************************
#ifndef FILE_H
#define FILE_H

#include <string>
#include "ModuleLoader/ModuleConfig.h"

namespace SystemTool
{
    class CLASS_ITEM File
    {
    public:
        // Set file writable
        static void SetWritable(std::string strFilePath, bool bIsWritable = true);

        // Set file read only
        static void SetReadonly(std::string strFilePath, bool bIsReadable = true);

        // Set file excutable
        static void SetExcutable(std::string strFilePath, bool bIsExcutable = true);

        // Get file size
        static unsigned long long GetSize(std::string strFilePath);

        // Copy file to a dir path
        static bool CopyTo(std::string strFilePath, std::string strDirPath, bool bIsOverWrite = true);

        // Move file to a dir path
        static bool MoveTo(std::string strFilePath, std::string strDirPath, bool bIsOverWrite = true);

        // Rename the file
        static bool Rename(std::string strFilePath, std::string strNewFilePath, bool bIsOverWrite = true);

        // Delete the file
        static bool Delete(std::string strFilePath);

        // Create file by recursively
        static bool Create(std::string strFilePath, bool bIsRecursively = true);

        // Get file name
        static std::string GetFileName(std::string strFilePath);

        // Get file's parent path
        static std::string GetFileParentDirPath(std::string strFilePath);

        // Is file existed
        static bool IsExisted(std::string strFilePath);
    };
}

#endif // FILE_H
